//bool, ObjList objs, str OUT reasonText

int i;
Unit me;

if (objs.count == 0) return false;

for(i = 0; i < objs.count(); i += 1){
	me = objs[i].AsUnit;
	if(!me.IsValid) return false;

	if(me.IsMilitary){
		if(!me.IsRanged){
			if(me.hero.IsValid){
				if(me.hero.TimePastLastAttack() < GetConst("HeroTimePastLastAttack")){
					if(me.EnemiesInSight()){ 
						reasonText = Translate("Unit in battle !");
						return false;
					}
				}
			}
		}
	}
}

return true;
